/**
 * Create by yxk at 2020/6/12
 */
import request from '@/utils/request'

/**
 * 销售订单新建/编辑
 */
export function jxcSaleAddOrUpdateAPI(data, isUpdate = false) {
  return request({
    url: 'jxcSale/addOrUpdate' + (isUpdate ? '/update' : '/add'),
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 销售订单删除
 */
export function jxcSaleDeleteByIdsAPI(data) {
  return request({
    url: 'jxcSale/deleteByIds',
    method: 'post',
    data: data
  })
}

/**
 * 销售订单详情
 */
export function jxcSaleQueryByIdAPI(data) {
  return request({
    url: `jxcSale/queryById/${data.label}`,
    method: 'post',
    data: data
  })
}

/**
 * 查询销售订单下的产品
 */
export function jxcSaleProductQuerySaleProductListAPI(data) {
  return request({
    url: 'jxcSaleProduct/queryJxcSaleProductList',
    method: 'post',
    data: data
  })
}

/**
 * 查询可进行销售的产品
 */
export function jxcSaleProductQueryPageListAPI(data) {
  return request({
    url: 'jxcSaleProduct/queryPageList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 销售订单出库记录
 */
export function jxcSaleQueryRecordAPI(data) {
  return request({
    url: 'jxcSale/queryRecord',
    method: 'post',
    data: data
  })
}

/**
 * 销售订单作废
 */
export function jxcSaleSetStateByIdsAPI(data) {
  return request({
    url: 'jxcSale/setStateByIds',
    method: 'post',
    data: data
  })
}

